# -*- coding: utf-8 -*-

import web

class Session:
    def __init__(self,sessionName):
        self.__sessionName=sessionName
        self.__session=web.ctx.session
    def get(self):
        try:
            return self.__session.__dict__[self.__sessionName]
        except:
            return None
    def set(self,sessionObject):
        self.__session.__dict__[self.__sessionName]= sessionObject
    def delete(self):
        """删除缓存"""
        data=self.get()
        if data:
            self.set(None)